import { base } from '@/config'
import http from '@/utils/request'

// 供应链
const finishApi = {
  /**
   * 获取金刚区列表
   * @param params
   * @returns {AxiosPromise}
   */
  getKongKimAreaList: params => {
    return http.get(`${base.platformBase}/platformIconSetting/getList`, { params })
  },

  /**
   * 添加金刚区
   * @param params
   * @returns {AxiosPromise}
   */
  addKongKimArea: params => {
    return http.postJson(`${base.platformBase}/platformIconSetting/save`, params)
  },

  /**
   * 编辑金刚区
   * @param params
   * @returns {AxiosPromise}
   */
  updateKongKimArea: params => {
    return http.postJson(`${base.platformBase}/platformIconSetting/update`, params)
  },

  /**
   * 获取金刚区详情
   * @param id
   * @returns {AxiosPromise}
   */
  getKongKimAreaInfo: id => {
    return http.get(`${base.platformBase}/platformIconSetting/get/${id}`)
  },

  /**
   * 修改金刚区启用 隐藏状态 updateEnable
   * @returns {AxiosPromise}
   */
  updateEnableKongKimArea: params => {
    return http.postJson(`${base.platformBase}/platformIconSetting/updateEnable`, params)
  },

  /**
   * 删除金刚区
   * @param id delete
   * @returns {AxiosPromise}
   */
  deleteKongKimArea: id => {
    return http.postJson(`${base.platformBase}/platformIconSetting/delete/${id}`)
  },

  /**
   * 获取菜单信息
   * @returns {AxiosPromise}
   */
  getMenuInfo: () => {
    return http.get(`${base.platformBase}/platformNavigationSetting/getList`)
  },

  /**
   * 保存底部导航栏
   * @param params
   * @returns {AxiosPromise}
   */
  addTabBar: params => {
    return http.postJson(`${base.platformBase}/platformNavigationSetting/save`, params)
  },

  /**
   * 底部导航栏恢复默认
   * @returns {AxiosPromise}
   */
  restoreTabBar: () => {
    return http.postJson(`${base.platformBase}/platformNavigationSetting/restore`)
  },

  /**
   * 获取我的页面列表
   * @param params
   * @returns {AxiosPromise}
   */
  getMyPageList: params => {
    return http.get(`${base.user}/statistics/getList`, { params })
  },

  /**
   * 添加页面
   * @param params
   * @returns {AxiosPromise}
   */
  addMyPage: params => {
    return http.postJson(`${base.user}/statistics/save`, params)
  },

  /**
   * 编辑我的页面
   * @param params
   * @returns {AxiosPromise}
   */
  updateMyPage: params => {
    return http.postJson(`${base.user}/statistics/update`, params)
  },

  /**
   * 获取我的页面按详情
   * @param id
   * @returns {AxiosPromise}
   */
  getMyPageInfo: id => {
    return http.get(`${base.user}/statistics/get/${id}`)
  },

  /**
   * 修改我的页面启用 隐藏状态
   * @param params
   * @returns {AxiosPromise}
   */
  updateEnableMyPage: params => {
    return http.postJson(`${base.user}/statistics/updateEnable`, params)
  },

  /**
   * 删除我的页面
   * @param id
   * @returns {AxiosPromise}
   */
  deleteMyPage: id => {
    return http.postJson(`${base.user}/statistics/delete/${id}`)
  }
}

export default finishApi
